home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Aventura
/
FireMan.swf
/
scripts
/
frame_1055
/
PlaceObject2_362_25
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
next >
Wrap
Text File
|
2008-09-12
|
3KB
|
133 lines
onClipEvent(enterFrame){
function doexplode()
{
myColor.setTransform(myColorNormal);
this.gotoAndStop("death");
}
function dorespawn()
{
currentdamage = 0;
hitted = false;
flashing = false;
timerdamage = 0;
death = false;
this.gotoAndStop("standing");
idle = true;
attack = preattack = attacking = false;
_X = xi;
_Y = yi;
shoot = new Sound();
shoot.attachSound("barrelshoot");
}
function drawframe()
{
if(idle)
{
this.gotoAndStop("standing");
}
if(attacking)
{
this.gotoAndStop("attack");
}
}
xi -= heroe.scrollspeed;
_X = _X - heroe.scrollspeed;
yi -= heroe.vscrollspeed;
_Y = _Y - heroe.vscrollspeed;
_visible = false;
hitable = this.hitTest(_parent.mascara);
if(hitable)
{
_visible = true;
if(this.sprite.hotzone.hitTest(heroe.sprite.hotzone))
{
heroe.damage = 3;
heroe.hitted = true;
}
if(this.sprite.hotzone.hitTest(_parent.shoot1) && hitable)
{
hitted = true;
_root.shoot1.impact = true;
_root.hitted.start();
}
if(timerdamage == 0 && hitted)
{
timerdamage = FLASHTIME;
currentdamage += DAMAGE;
}
if(timerdamage > 0)
{
flashing = true;
timerdamage % 3 != 0 ? myColor.setTransform(myColorNormal) : myColor.setTransform(myColorTransform);
timerdamage--;
}
if(flashing && timerdamage == 0)
{
flashing = false;
myColor.setTransform(myColorNormal);
hitted = false;
}
if(currentdamage >= MAXDAMAGE)
{
myColor.setTransform(myColorTransform);
delete shoot;
death = true;
}
if(death)
{
_root.shoot1.impact = false;
doexplode();
}
}
if(!death)
{
if(idle)
{
if(Math.abs(heroe._x - _X) <= 140 && Math.abs(heroe._y - _Y) <= 220)
{
attack = attacking = false;
idle = false;
preattack = true;
timer = DELAY;
}
}
if(preattack)
{
timer--;
if(!timer)
{
preattack = false;
attack = true;
}
}
if(attack && !attacking)
{
attacking = true;
this.attachMovie("bullet","b1",1);
this.attachMovie("bullet","b2",2);
shoot.start();
b1.control.dx = SPEED;
b1.control.dy = -1 * SPEED;
b1._x = -12;
b1._y = -14;
b2.control.dx = -1 * SPEED;
b2.control.dy = -1 * SPEED;
b2._x = 12;
b2._y = -14;
}
if(attacking)
{
if(!b1.hitTest(_root.mascara) && !b2.hitTest(_root.mascara))
{
attacking = attack = preattack = false;
idle = true;
}
}
drawframe();
}
else if(!_root.mascara.hitTest(xi,yi))
{
dorespawn();
}
}